package com.neuron.trafikanten.search;

import android.app.SearchManager;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;


/*
	
	public class TrafikantenSuggestionsProvider extends SearchRecentSuggestionsProvider {
	    public final static String AUTHORITY = "com.neuron.trafikanten.views.SelectStationSearchResultsView$TrafikantenSuggestionProvider";
	    public final static int MODE = DATABASE_MODE_QUERIES;

	    public TrafikantenSuggestionsProvider() {
	        setupSuggestions(AUTHORITY, MODE);
	    }
	}
 * 
 * 
 */
public class StationSearchProvider extends ContentProvider {
	private static final String TAG = "Trafikanten-StationSearchProvider";
    public static final String AUTHORITY = "com.neuron.trafikanten.search.StationSearchProvider";
    
    // For simplicity we use the same keys as trafikanten's api.
    public static final String SEARCHTYPE_REALTIME = "Sanntid";
    public static final String SEARCHTYPE_ROUTE = "Stoppested";
    
    private Context mContext;

	@Override
	public String getType(Uri uri) {
		return SearchManager.SUGGEST_MIME_TYPE;

	}

	@Override
	public boolean onCreate() {
		Log.i(TAG,"searchprovider oncreate");
		mContext = getContext();
		return true;
	}

	@Override
	public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
		//TODO : http://stackoverflow.com/questions/5867021/show-search-suggestions-while-typing-in-landscape-mode
		return BuildAutocompleteCursor.Autocomplete(mContext, selection, selectionArgs[0]);
	}
	
	@Override
	public int delete(Uri arg0, String arg1, String[] arg2) {
		throw new UnsupportedOperationException();
	}
	
	@Override
	public Uri insert(Uri arg0, ContentValues arg1) {
		throw new UnsupportedOperationException();
	}

	@Override
	public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
		throw new UnsupportedOperationException();
	}
	

}
